#include<iostream>
#include<algorithm>
using namespace std;
bool comp(int x,int y){
	return x>y;
}
int main(){
	int n,m;
	cin>>n>>m;
	int a[n],b[m];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	sort(a,a+n,comp);
	sort(b,b+m,comp);
	int count=0;
	int n1=n;
	if(n>=m){
		n1=m;
	}
	int i=n1-1,j=n1-1;
	for(int i1=0;i1<n1;i1++){
		if(a[i]<=b[j]){
			i--;
			j--;
			count++;
		}
		else{
			j--;
		}
	}
	cout<<count;
} 
